﻿package frEngine.shader.filters.fragmentFilters
{
    import __AS3__.vec.*;
    import frEngine.shader.*;
    import frEngine.shader.filters.*;

    public class UnderLevelFilter extends FilterBase
    {
        private var vecConstants:Vector.<Number>;

        public function UnderLevelFilter(param1:Number)
        {
            this.vecConstants = this.Vector.<Number>([0, 1, -1, 0.3]);
            super(FilterType.UnderLevelFilter, FilterPriority.UnderLevelFilter);
            this.vecConstants[3] = param1;
            return;
        }// end function

        public function get alpha() : Number
        {
            return this.vecConstants[3];
        }// end function

        public function set alpha(param1:Number) : void
        {
            this.vecConstants[3] = param1;
            return;
        }// end function

        override public function setRegisterParams(param1:Program3dRegisterInstance) : void
        {
            param1.getParamByName("{unlevel}", false).value = this.vecConstants;
            return;
        }// end function

        override public function get programeId() : String
        {
            return "UnderLevel0";
        }// end function

        override public function clone() : FilterBase
        {
            return this;
        }// end function

        override public function createVertexCode(param1:Program3dRegisterInstance, param2:int) : String
        {
            var _loc_3:Array = [new ToBuilderInfo("vf1", "{V_GloblePos}", false, 1)];
            param1.toBuild("", _loc_3);
            return "";
        }// end function

        override public function createFragmentColor(param1:Program3dRegisterInstance, param2:Boolean) : String
        {
            var _loc_3:Array = [new ToBuilderInfo("fc0", "{unlevel}", false, 1, this.vecConstants)];
            var _loc_4:* = "" + "mov ft0, {V_GloblePos} \n" + "sge ft0.y, ft0.y, {unlevel}.x \n" + "add ft0.y, ft0.y, {unlevel}.w \n" + "sat ft0.y, ft0.y \n" + "mov {output}.w,ft0.y \n";
            _loc_4 = param1.toBuild(_loc_4, _loc_3);
            return _loc_4;
        }// end function

    }
}
